package com.example.getaudit.common.exception;

/**
 * Exception 拦截
 */
public enum ExceptionCodeEnum implements ExceptionHandler {
    // 数据操作错误定义
    SUCCESS(0, "成功"),
    FAILED(-1, "操作失败"),
    PRAM_NOT_MATCH(400, "参数不正确"),
    VALIDATE_FAILED(400, "参数检验失败"),
    UNAUTHORIZED(401, "未登录或token过期，请登录！"),
    FORBIDDEN(403, "没有相关权限"),
    NOT_FOUND(404, "没有找到相关数据"),
    ERROR(-1, "系统异常"),
    ;

    private int code;
    private String msg;

    private ExceptionCodeEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    @Override
    public int getCode() {
        return code;
    }

    @Override
    public String getMsg() {
        return msg;
    }
}
